const mixins = {
  methods: {
    commaSplitAmount(num) {
      if (num) {
        if (num.toString().indexOf('.') > -1) {
          const [leftNum = '', rightNum = ''] = num.toString().split('.')

          return Number(leftNum).toLocaleString() + '.' + rightNum
        } else {
          return Number(num).toLocaleString()
        }
      } else {
        return num
      }
    },
    copyUrl(url) {
      const input = document.createElement('input')
      // input.hidden = true
      input.setAttribute('value', url)
      document.body.appendChild(input)
      input.select()
      document.execCommand('copy')
      document.body.removeChild(input)
      this.$message.success('复制成功')
    },
    filterMediaIcon(media) {
      if (Number(media)) {
        const mediaConfigIcon = {
          1: 'media_juliang',
          2: 'media_cili',
          3: 'media_ADQ',
          4: 'media_MP',
          5: 'media-jlqc',
          6: 'media_baidu',
          7: 'media_bilibili'
        }
        // console.log(media, mediaConfigIcon[Number(media)])
        return mediaConfigIcon[Number(media)]
      } else {
        return ''
      }
    }
  }
}
export default mixins
